<!doctype html>
<html>

<head>
	<meta charset="UTF-8">
	<meta name="viewport"
		content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title>登录1</title>
	<link rel="stylesheet" type="text/css" href="css/api.css" />
	<link rel="stylesheet" type="text/css" href="css/style.css" />
	<link rel="stylesheet" href="css/login.css">
	<link rel="stylesheet" href="css/modernforms.css">
	<link rel="stylesheet" href="css/font-awesome.min.css">
	<link rel="stylesheet" href="css/themes/theme-green.css">
	<link rel="stylesheet" href="css/aui/aui-toast.js">
	<style type="text/css">
		html,
		body {
			/*background-image: url('image/timg7.jpg');*/
			background-color: #FFFFFF;
			background-size: 100% 100%;
		}

		.uname {
			background-image: url('image/phoness.png');
			color: #1ABC9C;
			background-size: 25px 25px;
			background-position: 8px 8px;
			background-repeat: no-repeat;
			padding-left: 20px;
		}

		.pass {
			background-image: url('image/close.png');
			/*background-color:#FFFFFF;*/
			color: #1ABC9C;
			background-size: 25px 25px;
			background-position: 8px 8px;
			background-repeat: no-repeat;
			padding-left: 20px;
		}

		form {
			display: inline;
		}

		.gcs-checkbox {
			display: none;
		}

		.gcs-checkbox+label {
			background-color: white;
			border-radius: 0px;
			border: 1px solid #1ABC9C;
			width: 12px;
			height: 12px;
			display: inline-block;
			text-align: center;
			vertical-align: bottom;
			line-height: 10px;
		}

		.gcs-checkbox+label:hover {
			cursor: pointer;
			border: 1px solid #1ABC9C;
		}

		.gcs-checkbox:checked+label {
			background-color: #eee;
			background: #1ABC9C;
		}

		.gcs-checkbox:checked+label:after {
			content: "\2714";
			color: white;
		}

		.foot {
			margin: 0px auto;
			text-align: center;
			margin-top: 100px
		}
	</style>
</head>

<body>
	<div class="login-container">
		<img src="image/logo03.png" style="width: 70px;height: 63px;">
		<br>
		<br>
		<div class="connect">
			<h2>智慧园林</h2>
		</div>
		<div class="" style="color: #c4c4c4;margin-top: 35px;font-size: 13px;">
			<span style="margin-right: 40px;color: #1abc9c;">账号登录</span><span>|</span><span style="margin-left: 40px;"
				onclick="openDetail('./test_window.html')">试用申请</span>
		</div>
		<form action="" method="post" id="loginForm">
			<div>
				<input type="text" id="username" class="uname" style="color: #000000; text-indent: 30px;border-radius:20px"
					placeholder="请输入用户名" autocomplete="off" />
			</div>
			<div>
				<input type="password" id="pwds" class="pass" name="password"
					style="text-indent: 30px;border-radius:20px;color:#808080;" placeholder="请输入密码" oncontextmenu="return false"
					onpaste="return false" />
			</div>
			<br />
			<div style="float: left;margin-left: 10%;">
				<!--<input type="checkbox"  class="gcs-checkbox">-->
				<input type="checkbox" id="rpwd" class="gcs-checkbox">
				<label for="rpwd"></label>
				<span style=" color: #1ABC9C;font-size: 14px;">记住密码</span>
			</div>
			<button type="button" style="border-radius:20px;outline: none;background-color: #1ABC9C;" id="logins">
				登 陆
			</button>
		</form>
		<!-- <a href="html/register.html">
			<button type="button" class="register-tis" style="border-radius:20px">还有没有账号？</button>
			</a> -->
	</div>
	<div class="foot">
		<!-- <span style="font-size: 12px;color: #c4c4c4">临沂城投思索信息技术有限公司</span> -->
		<br />
		<span style="font-size: 12px;color: #c4c4c4;margin-top: 10px;">Copyright © 2019-2021</span>
	</div>
</body>
<script type="text/javascript" src="script/api.js"></script>
<script type="text/javascript" src="script/common.js"></script>
<script type="text/javascript" src="script/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="script/aui/aui-toast.js"></script>
<script type="text/javascript">
	apiready = function () {
		var isxy = $api.getStorage('isxy');
		if (!isxy) {
			var dialogBox = api.require('dialogBox');
			dialogBox.webView({
				tapClose: false,
				path: 'widget://html/yszc.html',
				texts: {
					title: '服务协议和隐私政策',
					leftBtnTitle: '不同意',
					rightBtnTitle: '同意'
				},
				styles: {
					bg: '#fff',
					corner: 2,
					w: 300,
					h: 280,
					title: {
						h: 44,
						size: 14,
						color: '#000'
					},
					upDividingLine: {
						width: 0.5,
						color: '#696969'
					},
					webView: {
						h: 192,
						bg: '#fff',
					},
					downDividingLine: {
						width: 0.5,
						color: '#696969'
					},
					left: {
						bg: 'rgba(0,0,0,0)',
						color: '#007FFF',
						size: 12
					},
					right: {
						bg: 'rgba(0,0,0,0)',
						color: '#007FFF',
						size: 12
					}
				}
			}, function (ret) {
				/* api.alert({
					msg: JSON.stringify(ret)
				}); */
				if (ret.eventType == 'left') {
					api.closeWidget({
						id: api.appId,
						retData: {
							name: 'closeWidget'
						},
						silent: true
					});
				} else {
					$api.setStorage('isxy', true);
					var dialogBox = api.require('dialogBox');
					dialogBox.close({
						dialogName: 'webView'
					});
				}
			});
		}
		var resultList = api.hasPermission({
			list: ['camera', 'contacts', 'photos']
		});
		//api.alert({
		//  msg:JSON.stringify(resultList)
		//});
		var rcpwdsession = "";
		if (typeof $api.getStorage('remember') != 'undefined') {
			rcpwdsession = $api.getStorage('remember');
		}
		if (rcpwdsession != "") {
			document.getElementById('username').value = rcpwdsession.ac;
			document.getElementById('pwds').value = rcpwdsession.pwd;
			var rc = document.getElementById("rpwd");
			rc.checked = true;
		}
		$("#logins").on('click', function () {
			var username = $("#username").val();
			var password = $("#pwds").val();
			// 表单方式提交数据或文件
			api.showProgress({
				title: '登录中...',
				modal: false
			});
			api.ajax({
				url: BaseServiceUrl + 'mobile/user/login.json',
				method: 'post',
				data: {
					values: {
						username: username,
						password: password
					}
				}
			}, function (ret, err) {
				if (ret) {
					switch (ret.code) {
						case 0:
							api.toast({
								msg: '登录成功',
								duration: 2000,
								location: 'bottom'
							});
							$api.setStorage('userSession', ret);
							//console.log(JSON.stringify(ret))
							var rc = document.getElementById("rpwd");
							if (rc.checked) {
								var obj = {
									ac: username,
									pwd: password
								};
								$api.setStorage('remember', obj);
								var rcpwdsession = $api.getStorage('remember');
							} else {
								$api.setStorage('remember', "");
							}
							if (ret.data.sysRole.sysRoleCode.role_number == "manage") { //管理角色选择项目
								openDetail('./list.html');
							} else if (ret.data.sysRole.sysRoleCode.role_number == "enterprise") { //领导角色无
								openDetail("./index.html");
							} else if (ret.data.sysRole.sysRoleCode.role_number == "construction") { //施工角色直接进入
								openDetail("./index.html");
							}
							break;
						case 1:
							api.toast({
								msg: ret.msg,
								duration: 2000,
								location: 'bottom'
							});
							$api.setStorage('remember', "");
							break;
						default:
							api.alert({
								msg: '登录失败，检出网络设置！'
							});
							break;
					}
					api.hideProgress();
				} else {
					api.hideProgress();
				}
			});
		})
	}
</script>

</html>